home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Languages / Quick C 2.0 / INCLUDE / FLOAT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1988-12-05  |  4.8 KB  |  138 lines

  1. /***
  2. *float.h - constants for floating point values
  3. *
  4. *    Copyright (c) 1985-1989, Microsoft Corporation.  All rights reserved.
  5. *
  6. *Purpose:
  7. *    This file contains defines for a number of implementation dependent
  8. *    values which are commonly used by sophisticated numerical (floating
  9. *    point) programs.
  10. *    [ANSI]
  11. *
  12. ****/
  13.  
  14.  
  15. #ifndef NO_EXT_KEYS    /* extensions enabled */
  16.     #define _CDECL    cdecl
  17. #else /* extensions not enabled */
  18.     #define _CDECL
  19. #endif /* NO_EXT_KEYS */
  20.  
  21. #define DBL_DIG     15            /* # of decimal digits of precision */
  22. #define DBL_EPSILON     2.2204460492503131e-016 /* smallest such that 1.0+DBL_EPSILON != 1.0 */
  23. #define DBL_MANT_DIG    53            /* # of bits in mantissa */
  24. #define DBL_MAX     1.7976931348623158e+308 /* max value */
  25. #define DBL_MAX_10_EXP    308            /* max decimal exponent */
  26. #define DBL_MAX_EXP    1024            /* max binary exponent */
  27. #define DBL_MIN     2.2250738585072014e-308 /* min positive value */
  28. #define DBL_MIN_10_EXP    -307            /* min decimal exponent */
  29. #define DBL_MIN_EXP    -1021            /* min binary exponent */
  30. #define DBL_RADIX    2            /* exponent radix */
  31. #define DBL_ROUNDS    1            /* addition rounding: near */
  32.  
  33. #define FLT_DIG     6            /* # of decimal digits of precision */
  34. #define FLT_EPSILON    1.192092896e-07     /* smallest such that 1.0+FLT_EPSILON != 1.0 */
  35. #define FLT_GUARD    0
  36. #define FLT_MANT_DIG    24            /* # of bits in mantissa */
  37. #define FLT_MAX     3.402823466e+38     /* max value */
  38. #define FLT_MAX_10_EXP    38            /* max decimal exponent */
  39. #define FLT_MAX_EXP    128            /* max binary exponent */
  40. #define FLT_MIN     1.175494351e-38     /* min positive value */
  41. #define FLT_MIN_10_EXP    -37            /* min decimal exponent */
  42. #define FLT_MIN_EXP    -125            /* min binary exponent */
  43. #define FLT_NORMALIZE    0
  44. #define FLT_RADIX    2            /* exponent radix */
  45. #define FLT_ROUNDS    1            /* addition rounding: near */
  46.  
  47. #define LDBL_DIG    DBL_DIG         /* # of decimal digits of precision */
  48. #define LDBL_EPSILON    DBL_EPSILON        /* smallest such that 1.0+LDBL_EPSILON != 1.0 */
  49. #define LDBL_MANT_DIG    DBL_MANT_DIG        /* # of bits in mantissa */
  50. #define LDBL_MAX    DBL_MAX         /* max value */
  51. #define LDBL_MAX_10_EXP DBL_MAX_10_EXP        /* max decimal exponent */
  52. #define LDBL_MAX_EXP    DBL_MAX_EXP        /* max binary exponent */
  53. #define LDBL_MIN    DBL_MIN         /* min positive value */
  54. #define LDBL_MIN_10_EXP DBL_MIN_10_EXP        /* min decimal exponent */
  55. #define LDBL_MIN_EXP    DBL_MIN_EXP        /* min binary exponent */
  56. #define LDBL_RADIX    DBL_RADIX        /* exponent radix */
  57. #define LDBL_ROUNDS    DBL_ROUNDS        /* addition rounding: near */
  58.  
  59.  
  60. /*
  61.  *    8087/80287 math control information
  62.  */
  63.  
  64.  
  65. /* User Control Word Mask and bit definitions.
  66.  * These definitions match the 8087/80287
  67.  */
  68.  
  69. #define MCW_EM        0x003f        /* interrupt Exception Masks */
  70. #define EM_INVALID    0x0001        /*  invalid */
  71. #define EM_DENORMAL    0x0002        /*  denormal */
  72. #define EM_ZERODIVIDE    0x0004        /*  zero divide */
  73. #define EM_OVERFLOW    0x0008        /*  overflow */
  74. #define EM_UNDERFLOW    0x0010        /*  underflow */
  75. #define EM_INEXACT    0x0020        /*  inexact (precision) */
  76.  
  77. #define MCW_IC        0x1000        /* Infinity Control */
  78. #define IC_AFFINE    0x1000        /*  affine */
  79. #define IC_PROJECTIVE    0x0000        /*  projective */
  80.  
  81. #define MCW_RC        0x0c00        /* Rounding Control */
  82. #define RC_CHOP     0x0c00        /*  chop */
  83. #define RC_UP        0x0800        /*  up */
  84. #define RC_DOWN     0x0400        /*  down */
  85. #define RC_NEAR     0x0000        /*  near */
  86.  
  87. #define MCW_PC        0x0300        /* Precision Control */
  88. #define PC_24        0x0000        /*  24 bits */
  89. #define PC_53        0x0200        /*  53 bits */
  90. #define PC_64        0x0300        /*  64 bits */
  91.  
  92.  
  93. /* initial Control Word value */
  94.  
  95. #define CW_DEFAULT ( IC_AFFINE + RC_NEAR + PC_64 + EM_DENORMAL + EM_UNDERFLOW + EM_INEXACT )
  96.  
  97.  
  98. /* user Status Word bit definitions */
  99.  
  100. #define SW_INVALID    0x0001        /* invalid */
  101. #define SW_DENORMAL    0x0002        /* denormal */
  102. #define SW_ZERODIVIDE    0x0004        /* zero divide */
  103. #define SW_OVERFLOW    0x0008        /* overflow */
  104. #define SW_UNDERFLOW    0x0010        /* underflow */
  105. #define SW_INEXACT    0x0020        /* inexact (precision) */
  106.  
  107.  
  108. /* invalid subconditions (SW_INVALID also set) */
  109.  
  110. #define SW_UNEMULATED        0x0040        /* unemulated instruction */
  111. #define SW_SQRTNEG        0x0080        /* square root of a neg number */
  112. #define SW_STACKOVERFLOW    0x0200        /* FP stack overflow */
  113. #define SW_STACKUNDERFLOW    0x0400        /* FP stack underflow */
  114.  
  115.  
  116. /*  Floating point error signals and return codes */
  117.  
  118. #define FPE_INVALID        0x81
  119. #define FPE_DENORMAL        0x82
  120. #define FPE_ZERODIVIDE        0x83
  121. #define FPE_OVERFLOW        0x84
  122. #define FPE_UNDERFLOW        0x85
  123. #define FPE_INEXACT        0x86
  124.  
  125. #define FPE_UNEMULATED        0x87
  126. #define FPE_SQRTNEG        0x88
  127. #define FPE_STACKOVERFLOW    0x8a
  128. #define FPE_STACKUNDERFLOW    0x8b
  129.  
  130. #define FPE_EXPLICITGEN     0x8c    /* raise( SIGFPE ); */
  131.  
  132. /* function prototypes */
  133.  
  134. unsigned int _CDECL _clear87(void);
  135. unsigned int _CDECL _control87(unsigned int,unsigned int);
  136. void _CDECL _fpreset(void);
  137. unsigned int _CDECL _status87(void);
  138.